package com.flyme.module.base.provider.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.flyme.core.base.supper.service.impl.BaseServiceImpl;
import com.flyme.module.base.client.entity.SysChangecertificate;
import com.flyme.module.base.client.entity.SysUsercertificate;
import com.flyme.module.base.provider.mapper.SysChangecertificateMapper;
import com.flyme.module.base.provider.service.SysChangecertificateService;
import com.flyme.module.base.provider.service.SysUsercertificateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SysChangecertificateServiceImpl extends BaseServiceImpl<SysChangecertificateMapper, SysChangecertificate> implements SysChangecertificateService {

    @Autowired
    private SysUsercertificateService usercertificateService;

    @Override
    public SysChangecertificate findByIdCard(String idCard, String certificateNum){
        SysUsercertificate usercertificate = usercertificateService.findByIdCard(idCard, certificateNum);
        return getOne(q().eq(true,"idCard", idCard).eq(true, "auditState", "1").eq(true, "sysUsercertificateId", usercertificate.getId()), false);
    }

    @Override
    public SysChangecertificate findByIdCard2(String idCard, String certificateNum, Integer auditState){
        SysUsercertificate usercertificate = usercertificateService.findByIdCard(idCard, certificateNum);
        return getOne(q().eq(true,"idCard", idCard).eq(true, "auditState", auditState).eq(true, "sysUsercertificateId", usercertificate.getId()), false);
    }
}
